package net.wanho.config;

import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class LocalDataTimeConfig {
    public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";

    @Bean
    public Jackson2ObjectMapperBuilderCustomizer customizer() {
        return builder -> builder.locale(java.util.Locale.CHINA)
                .timeZone(java.util.TimeZone.getTimeZone("GMT+8"))
                .dateFormat(new java.text.SimpleDateFormat(DATE_TIME_PATTERN));
    }
}
